%option noyywrap nodefault yylineno case-insensitive

%{
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include "y.tab.h"

%}

%%
SELECT 				    { return SELECT; }
DROP 				    { return DROP; }
TABLE 				    { return TABLE; }
TABLES					{ return TABLES; }
DATABASE				{ return DATABASE; }
DATABASES				{ return DATABASES; }
CREATE				    { return CREATE; }
INSERT				    { return INSERT; } 
UPDATE				    { return UPDATE; } 
SET 					{ return SET; } 
DELETE 				    { return DELETE; } 
FROM					{ return FROM; } 
WHERE					{ return WHERE; } 
INTO 					{ return INTO; } 
VALUES					{ return VALUES; } 
AND						{ return AND; } 
OR						{ return OR; } 
INT   					{ return INT; } 
CHAR 					{ return CHAR; }  
SHOW					{ return SHOW; } 
EXIT					{ return EXIT; } 
USE						{ return USE; } 
[;]		|				
[(]		|				
[)]		|				
[*]		|				
[,]		|				
"<="	|
">="	|
[!]		|
"<"		|
">"		|
[=]		|
[+]		|
[-]		|
[/]                    return *yytext;
[\'][A-Za-z][A-Za-z0-9_]*[\'] 		{ yylval.strval=strdup(yytext); return STRING; }
[A-Za-z][A-Za-z0-9_]*	            { yylval.strval=strdup(yytext); return ID; }
[0-9]+ 		                        { yylval.intval=atoi(yytext); return NUMBER;	}
\n						            return *yytext;
[ \t]+					            /* ignore whitespace */
%%